<template>
  <div>
    <el-table
      :data="goods"
      style="width: 100%"
      default-expand-all
      row-key="id"
      :tree-props="{ children: 'children' }"
    >
      <el-table-column label="名称" prop="title"> </el-table-column>
      <el-table-column label="图标" prop="icon">
        <template slot-scope="scope">
          <i :class="scope.row.icon"></i>
        </template>
      </el-table-column>
      <el-table-column label="类型" prop="type">
        <template slot-scope="scope">
          <el-tag :type="scope.row.type == 1 ? 'success' : 'warning'">
            {{ scope.row.type == 1 ? "目录" : "菜单" }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
            >编辑</el-button
          >
          <el-button size="mini" @click="handleDelete(scope.row.id)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  props: ["goods" ],

  data() {
    return {};
  },
  created() {
    // console.log(this.goods);
  },
  methods: {
    //编辑
    handleEdit(index, row) {
      // console.log(index, row);
      this.$emit('Edits',row)
    },
    //删除
    handleDelete(id) {
       this.$emit('delet',id)
    },
  },
};
</script>
<style lang="scss" scoped>
</style>